﻿<?php
require '../../frame/base.php';

$userId = !empty($_REQUEST['userId'])?$_REQUEST['userId']:null;

if($userId){
	$msg=$Db->table('sendmsg')->join([
		['user u','u.userid=sendmsg.fromId'],
		])->field('u.niname,u.images,sendmsg.note,sendmsg.send_at')->where('is_read',false)->where('fromId','<>',$userId)->where('targetId',$userId)->select();
	$ary=['code'=>200,'msg'=>'成功','data'=>$msg];	
}else{
	$ary=['code'=>200,'msg'=>'成功','data'=>[]];	
}
echo json_encode($ary);





